/*
 * @Author: wurangkun
 * @Date: 2024-05-31 21:32:38
 * @LastEditTime: 2024-05-31 21:35:25
 * @LastEditors: wurangkun
 * @FilePath: \my-app\hooks\useStateBarHeight.ts
 * @Description:
 */
import { NativeModules, Platform, StatusBar } from "react-native";


export const StatusBarHeight = async () =>
  new Promise<number>((resolve) => {
    if (Platform.OS === 'android') {
      console.log(StatusBar.currentHeight)
      resolve(StatusBar.currentHeight ?? 0)
    } else if (Platform.OS === 'ios') {
      const { StatusBarManager } = NativeModules;
      // iOS Only
      StatusBarManager.getHeight((statusBarHeight: { height?: number; }) => {
        resolve(statusBarHeight.height ?? 0)
      });
    }
  })
